#include <iostream>

using std::cout;
using std::endl;

class Point
{
public:
    Point(int ix = 0, int iy = 0)
    : _ix(ix)
    , _iy(iy)
    {
        cout << "Point(int,int)" << endl;
    }

    //如果不显式提供的情况下，系统也会自动提供一个拷贝构造函数
    Point(const Point rhs)
    : _ix(rhs._ix)
    , _iy(rhs._iy)
    {
        cout << "Point(const Point&)" << endl;
    }

    ~Point() {
        cout << "~Point()" << endl;
    }

    void print() 
    {
        cout << "(" << _ix << "," << _iy << ")" << endl;
    }

private:
    int _ix;
    int _iy;
};


int test0()
{
    //对象的复制
    Point pt1(10, 11);
    Point pt2(pt1);

    cout << "pt1:";
    pt1.print();

    cout << "pt2:";
    pt2.print();

    return 0;
}

int main()
{
    test0();
    return 0;
}

